package com.itheima.controller;

import com.itheima.common.pojo.DishVo2;
import com.itheima.common.pojo.Result;
import com.itheima.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dish")
public class DishController {

    @Autowired
    private DishService dishService;

    @GetMapping("/list")
    public Result list(@RequestParam("categoryId") String categoryId,@RequestParam("status")  Integer status,
                       @RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer pageSize){

        List<DishVo2> all = dishService.getAll(categoryId, status, page, pageSize);
        return Result.success("成功",all);


    }

}
